package com.itheima.stock.config;

import com.itheima.stock.cache.Cache;
import com.itheima.stock.cache.imp.RedisCache;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * 缓存配置类，用于注册Cache接口的实现类到Spring容器
 */
@Configuration
public class CacheConfiguration {
    
    @Bean
    public Cache cache(StringRedisTemplate stringRedisTemplate) {
        // 创建RedisCache实例并注入StringRedisTemplate
        return new RedisCache(stringRedisTemplate);
    }
}
